//skill prices, now allowed to evolve over time
***********ACS Data***********
use "$temp/acs_master", clear //open
drop if school==2

//restrictions and regressoin variables
gen black = (race == 2) //black dummy
gen male = (sex == 1) //sex dummy
gen hispanic = (hispan!=0) //hispanic

//hs sample
keep if year>=2008 & year<=2012
keep if educ == 6
gen exp = age - (educ+12)
drop if exp<0
keep if race == 1 | race == 2
keep if male
keep statefip year black male hispanic educ wage_hourly perwt bpl age hours exp

//wrap up
keep if age>=25 & age<=54
compress
gen stfips = statefip
merge m:1 stfips using "$data/Crosswalks/state_div_crosswalk", keep(match) nogen
save "$temp/ACS_skill_price_sample", replace

use "$temp/ACS_skill_price_sample", clear

//log wage variable
gen l_wage = log(wage_hourly)

//
gen coll = (educ>=10)



//regression on whole sample
reg l_wage black c.exp##c.exp##c.exp##c.exp ib4.div [fweight=perwt], robust

//store estimates
levelsof div, clean local(divs)
foreach div in `divs'{
	if `div' == 4{
			regsave `div'b.division using "$temp/div_wage_effects_`div'", replace
	}
	else{
			regsave `div'.division using "$temp/div_wage_effects_`div'", replace
	}
}

//regression by race
reg l_wage black c.exp##c.exp##c.exp##c.exp ib4.div##i.black [fweight=perwt], robust

//store estimates
levelsof div, clean local(divs)
foreach div in `divs'{
	if `div' == 4{
			regsave `div'b.division using "$temp/div_wage_effects_`div'_w", replace
			regsave `div'b.division#1o.black using "$temp/div_wage_effects_`div'_b", replace
	}
	else{
			regsave `div'.division using "$temp/div_wage_effects_`div'_w", replace
			regsave `div'.division#1.black using "$temp/div_wage_effects_`div'_b", replace
	}
}

********assembly*********
levelsof div, clean local(divs)

//all
clear
foreach div in `divs'{
	append using "$temp/div_wage_effects_`div'"
}
gen div = _n 
keep div coef
ren coef wage_effect
save "$temp/div_wages_all", replace

//whites
clear
foreach div in `divs'{
	append using "$temp/div_wage_effects_`div'_w"
}
gen div = _n 
keep div coef
ren coef wage_effect
save "$temp/div_wages_w", replace

//blacks
clear
foreach div in `divs'{
	append using "$temp/div_wage_effects_`div'_b"
}
gen div = _n 
keep div coef
ren coef wage_effect
save "$temp/div_wages_b", replace

